using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace UM_Model.Models.Mapping
{
    public class ActivityRegisterMap : EntityTypeConfiguration<ActivityRegister>
    {
        public ActivityRegisterMap()
        {
            // Primary Key
            this.HasKey(t => t.ID);

            // Properties
            // Table & Column Mappings
            this.ToTable("ActivityRegister");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.Acivity).HasColumnName("Acivity");
            this.Property(t => t.UnionistID).HasColumnName("UnionistID");
            this.Property(t => t.RegisterDate).HasColumnName("RegisterDate");
            this.Property(t => t.IsEnable).HasColumnName("IsEnable");
            this.Property(t => t.IsAccept).HasColumnName("IsAccept");

            // Relationships
            this.HasOptional(t => t.Activity)
                .WithMany(t => t.ActivityRegisters)
                .HasForeignKey(d => d.Acivity);
            this.HasOptional(t => t.Unionist)
                .WithMany(t => t.ActivityRegisters)
                .HasForeignKey(d => d.UnionistID);

        }
    }
}
